package com.jml.装饰模式实现三级缓存.factory;


import com.jml.装饰模式实现三级缓存.component.ComponentCache;
import com.jml.装饰模式实现三级缓存.component.impl.OneLevelCacheComponent;
import com.jml.装饰模式实现三级缓存.decorator.impl.ThreeDecorator;
import com.jml.装饰模式实现三级缓存.decorator.impl.TwoRedisDecorator;

/**
 * @author:jml
 * @date: 2019/9/9 14:17
 * @description：
 */
public class MainFactoryCache {

    public static ComponentCache getTwoComponentCache() {
        return new TwoRedisDecorator(new OneLevelCacheComponent());
    }

    public static ComponentCache getThreeComponentCache() {
        return new ThreeDecorator(new TwoRedisDecorator(new OneLevelCacheComponent()));
    }

    public static void main(String[] args) {
        ComponentCache componentCache = getThreeComponentCache();
        Object jml = componentCache.getCache("jml");
        Object jml1 = componentCache.getCache("jml");
        System.out.println(jml);
        System.out.println(jml1);
    }


}
